<template>
  <a-drawer :width="500" :visible="show" :footer="false" @cancel="handleCancel" unmountOnClose>
    <template #title>
      {{data.type}}组件编辑
    </template>
    <div class="setting-content">
      <p class="item-title">标题</p>
      <a-input v-model="data.data.title" placeholder="请输入标题" allow-clear />

      <p class="item-title">图片</p>
      <img class="item-img" :src="data?.data?.imgSrc" />
      <div class="item-uplaod flex items-center">
        <a-input v-model="data.data.imgSrc" placeholder="请输入图片链接" allow-clear />
        <Upload v-model="data.data.imgSrc" name="bannerImage" />
      </div>
    </div>
  </a-drawer>
</template>

<script lang="ts" setup>
import Upload from '@/common/Upload/index.vue'

defineProps({
  show: {
    type: Boolean,
    default: false
  },

  data: {
    type: Object,
    default: () => {}
  }
})

const emit = defineEmits(['update:show']);

const handleCancel = () => {
  emit('update:show', false);
}
</script>

<style lang="scss" scoped>
.setting-content {
  position: relative;

  .item-title {
    padding: 12px 0 8px 0;
    font-size: 14px;
    font-weight: 600;
  }

  .item-img {
    margin-top: 12px;
    height: 160px;
  }
}
</style>